package com.ocom.wxapi.controller;

import com.ocom.common.request.payconfig.TotalTurnoverRequest;
import com.ocom.common.resp.Result;
import com.ocom.wxapi.client.PayConfigClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@PreAuthorize("hasRole('ROLE_WX')")
@RequestMapping("/TurnoverPage")
@RestController
@Slf4j
public class XFPayController {

    @Autowired
    private PayConfigClientService payConfigClientService;

    @PostMapping("/onShow")
    public Result add(@Valid TotalTurnoverRequest totalTurnoverRequest) {
        log.info("获取消费报表 参数【{}】",totalTurnoverRequest);
//        YoCiUser yoCiUser= SecurityUtils.getYoCiUser();
//        log.info("获取消费报表-管理员 参数【{}】",yoCiUser);
//        List<EntityMngUserInfo> list=yoCiUser.getWxAdmin();
//        for (EntityMngUserInfo entityMngUserInfo : list) {
//            if (entityMngUserInfo.getRole()==41L){
//                totalTurnoverRequest.setMerchID(entityMngUserInfo.getBnsId());
//            }
//        }
        log.info("获取消费报表-调用参数 参数【{}】",totalTurnoverRequest);
        return payConfigClientService.getTurnoverReports(totalTurnoverRequest);
    }
}
